package cn.lhx.blog.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH;

import cn.lhx.blog.dao.DaoUpload;
import cn.lhx.blog.pojo.UploadItem;
import cn.lhx.blog.service.UploadItemService;
@Transactional
public class UploadItemServiceBean implements UploadItemService{
	@Resource(name="daoUpload")
	private DaoUpload daoUpload;
	
	public UploadItem addUploadItem(UploadItem item) {
		daoUpload.insert(item);
		return item;
	}

	public int delUploadItem(int id) {
		daoUpload.delete(id);
		return id;
	}
	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public List<UploadItem> getUploadItems(int begin, int size) {
		List<UploadItem> items=new ArrayList<UploadItem>();
		items=(ArrayList<UploadItem>)daoUpload.getList(begin, size);
		return items;
	}
	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public UploadItem getUptItem(int id) {
		UploadItem item=(UploadItem)daoUpload.getById(id);
		return item;
	}
	

}
